#include "./USMART/usmart.h"
#include "./USMART/usmart_str.h"

/******************************************************************************************/
/* 用户配置区
 * 这下面要包含所用到的函数所申明的头文件(用户自己添加)
 */
#include "main.h"

// extern void led_set(uint8_t sta);
// extern void test_fun(void(*ledset)(uint8_t), uint8_t sta);
void led_set(uint8_t sta) {
  if (sta) {
    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_SET);
  } else {
    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_RESET);
  }
}
//调参用的
int gl_value1,gl_value2,gl_value3,gl_value4,gl_value5,gl_value6;
void setGlValue(int v1,int v2,int v3,int v4,int v5,int v6){
  gl_value1 =v1;
  gl_value2 = v2;
  gl_value3 = v3;
  gl_value4 = v4;
  gl_value5 = v5;
  gl_value6 = v6;
}
extern int gyro_getYawInt();
void Test_rotAngleCommon(int angle,int direction);
void Test_speedUp(int16_t dis,int16_t acc,uint16_t max);
void Test_speedUpRes(int16_t dis,int16_t acc,uint16_t max);
void Test_flMethod_gyro(int16_t speed);
void playMusic(int i);
void Test_rotFast(int angle,int distance,int speed);
void planLineWayTest(uint8_t nowNode , uint8_t targetNode , uint8_t targetNextNode);
void Test_AutoWayConnect(int index);
#include <stdbool.h>
bool collision_seekFront(void);
/* 函数名列表初始化(用户自己添加)
 * 用户直接在这里输入要执行的函数名及其查找串
 */
struct _m_usmart_nametab usmart_nametab[] = {
#if USMART_USE_WRFUNS == 1 /* 如果使能了读写操作 */
    (void *)read_addr,  "uint32_t read_addr(uint32_t addr)",
    (void *)write_addr, "void write_addr(uint32_t addr,uint32_t val)",
#endif

    (void *)led_set,    "void led_set(uint8_t sta)",
    (void *)gyro_getYawInt, "int gyro_getYawInt()",
    (void *)Test_rotAngleCommon, "void Test_rotAngleCommon(int angle,int direction)",
    (void *)Test_speedUp, "void Test_speedUp(int16_t dis,int16_t acc,uint16_t max)",
    (void*)Test_speedUpRes,"void Test_speedUpRes(int16_t dis,int16_t acc,uint16_t max)",
    (void*)Test_flMethod_gyro,"void Test_flMethod_gyro(int16_t speed)",
    (void*)collision_seekFront,"bool collision_seekFront(void)",
    (void*)setGlValue, "void setGlValue(int v1,int v2,int v3,int v4,int v5,int v6)",
    (void*)playMusic, "void playMusic(int i)",
    (void*)Test_rotFast, "void Test_rotFast(int angle,int distance,int speed)",
    (void*)planLineWayTest, "void planLineWayTest(uint8_t nowNode , uint8_t targetNode , uint8_t targetNextNode)",
    (void*)Test_AutoWayConnect, "void Test_AutoWayConnect(int index)",
    // (void *)test_fun, "void test_fun(void(*ledset)(uint8_t), uint8_t sta)",
};

/******************************************************************************************/

/* 函数控制管理器初始化
 * 得到各个受控函数的名字
 * 得到函数总数量
 */
struct _m_usmart_dev usmart_dev = {
    usmart_nametab,
    usmart_init,
    usmart_cmd_rec,
    usmart_exe,
    usmart_scan,
    sizeof(usmart_nametab) / sizeof(struct _m_usmart_nametab), /* 函数数量 */
    0, /* 参数数量 */
    0, /* 函数ID */
    1, /* 参数显示类型,0,10进制;1,16进制 */
    0, /* 参数类型.bitx:,0,数字;1,字符串 */
    0, /* 每个参数的长度暂存表,需要MAX_PARM个0初始化 */
    0, /* 函数的参数,需要PARM_LEN个0初始化 */
};
